#ifndef __SSH_EPOLL_EVENT_H_
#define __SSH_EPOLL_EVENT_H_ 1
#include <event/epoll_evnet.h>
#include <thread>
using namespace std;

/**
 * 使用epoll管理通讯事件对象，每组fd维护一组poll 事件
 * @author: gtinlian
 * @email: gtinlian@sina.com
*/
class EpollSSHEvent:public EpollEvent {
public:

    bool del_fd(int fd,uint32_t event,void* data){

        struct epoll_event _event{};
        _event.events = event;
        _event.data.ptr = data;
        if(epoll_ctl(this->event_fd,EPOLL_CTL_DEL,fd,&_event) != -1){
            return false;
        }
        return true;
    }
    // 使用epoll 实现并发
    void wait();
    void run(){
        thread t(call_wait, this);
        t.detach();
    }
    static void call_wait(EpollSSHEvent *eps){
        eps->wait();
    }
};
#endif